'''
class Car:
    color='白色'
    def drive(self):
        print('能开很远')





class Dog:
    color = '白色'
    def eat(self):
        print('狗在吃')
    def run(self):
        print('狗在跑')
    def call(self):
        print('狗在叫')

dog=Dog()
dog.call()
dog.eat()
dog.run()







class book:
    title='书名'
    author='作者'
    pages='页数'
    publication_date='出版日期'

    def __init__(self,title,author,publication_date,pages):
        self.title=title
        self.author=author
        self.publication_date=publication_date
        self.pages=pages
    
    def deplay_info(self):
        print(f'书名:{self.title},作者:{self.author},出版日期:{self.publication_date}页数:{self.pages}')

    def __del__(self):
        print('对象被销毁')



book1=book('《活着》','余华','2000年',1000)


book1.deplay_info()





class BankAccount:
    def __init__(self,name):
        self.name=name
        self.__balance=0

    def set_account(self,new_account):
        self.__balance=new_account
    

    def get_account(self):
        return self.__balance



    def get_balance(self):
        return self.__balance


    def display_user_info(self):
        print(f'姓名:{self.name},余额为:{self.__balance}')


account1=BankAccount('张三')

account1.set_account(10000)
account1.display_user_info()



class Animals:
    def __init__(self,name):
        self.name=name

    def make_sound(self):
        print(f'{self.name}发出声音')
        

class Dog(Animals):
    def make_sound(self):
        print(f'{self.name}汪汪')


class Cat(Animals):
    def make_sound(self):
        print(f'{self.name}喵喵')


d=Dog('小黄')
o=Dog('小白')
c=Cat('小喵')
a=Cat('小黑')

d.make_sound()
o.make_sound()
c.make_sound()
a.make_sound()

'''

class Shape:
    def area(self):
        print('这是一个形状')

class Circle(Shape):
    def area(self):
        print('这是一个圆形')

class Rectangle(Shape):
    def area(self):
        print('这是一个三角形')


def calculate_area(obj):
    obj.area()

ci=Circle()
rec=Rectangle()

calculate_area(ci)
calculate_area(rec)








